package com.woniuxy;

import com.alibaba.fastjson.JSON;

import java.util.HashMap;
import java.util.Map;

public class test {
    public static void main(String[] args) {
//        toJosn();
//        toMap();

    }

    private static void toMap() {
        String  josnTest = "{\"name\":\"张三\",\"age\":18}";
        Map<String, String> map = JSON.parseObject(josnTest, Map.class);
        System.out.println(map.get("name"));
    }

    private static void toJosn() {
        Map<String, String> map = new HashMap<>();
        map.put("1", "1");
        map.put("2", "2");
        map.put("3", "3");

        String json = JSON.toJSONString(map); // 使用 FastJSON 转换
        System.out.println(json);
    }
}
